//
//  UIImage+LLResize.m
//  live.ly
//
//  Created by CuiHao on 9/7/16.
//  Copyright © 2016 musical.ly. All rights reserved.
//

#import "UIImage+LLResize.h"


@implementation UIImage (LLResize)

+ (UIImage *)ll_imageWithImage:(UIImage *)image scaledToSize:(CGSize)newSize
{
    //UIGraphicsBeginImageContext(newSize);
    // In next line, pass 0.0 to use the current device's pixel scaling factor (and thus account for Retina resolution).
    // Pass 1.0 to force exact pixel size.
    UIGraphicsBeginImageContextWithOptions(newSize, NO, 0.0);
    [image drawInRect:CGRectMake(0, 0, newSize.width, newSize.height)];
    UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return newImage;
}

@end
